***Democracy and Changing Leadership Preferences among Young Individuals: The Case of South Korea***

*** Recode Variables ***
gen age2 = 2022-Q27

gen age = .
replace age = 1 if age2<26
replace age = 2 if age2>=26 & age2<36
replace age = 3 if age2>=36 & age2<46
replace age = 4 if age2>=46 & age2<66
replace age = 5 if age2>=66

gen age4 = .
replace age4 = 1 if age2<30
replace age4 = 2 if age2>=30 & age2<45
replace age4 = 3 if age2>=45 & age2<60
replace age4 = 4 if age2>=60

gen age10 = .
replace age10 = 1 if age2<30
replace age10 = 2 if age2>=30 & age2<40
replace age10 = 3 if age2>=40 & age2<50
replace age10 = 4 if age2>=50 & age2<60
replace age10 = 5 if age2>=60

gen age11 = age10
recode age11 (1=0)(2=.25)(3=.5)(4=.75)(5=1)

gen age40 = .
replace age40 = 1 if age2<40
replace age40 = 2 if age2>=40

gen younger = .
replace younger = 1 if age10==1
replace younger = .75 if age10==2
replace younger = .5 if age10==3
replace younger = .25 if age10==4
replace younger = 0 if age10==5

gen income = Q33
recode income (1=1)(2=1)(3=2)(4=2)(5=2)(6=2)(7=3)(8=3)(9=3)(else=.)
gen income1 = Q33
recode income1 (1=0)(2=.2)(3=.3)(4=.4)(5=.5)(6=.6)(7=.7)(8=.8)(9=.1)

gen class = Q32
recode class (1=1)(2=1)(3=2)(4=3)(5=3)
gen class1 =Q32
recode class1 (1=0)(2=.25)(3=.50)(4=.75)(5=1)

gen gender = Q28
recode gender (1=1)(2=0)

gen education = Q29
recode education (1=1)(2=1)(3=1)(4=2)(5=2)(6=3)
gen edu = Q29
recode edu (1=0)(2=0)(3=.25)(4=.5)(5=.75)(6=1)

gen employment = .
replace employment = 1 if Q30_1==1
replace employment = .5 if Q30_2==1 | Q30_3==1 | Q30_4==1
replace employment = 0 if Q30_5==1 | Q30_6==1

gen married=Q34
recode married (1=0)(2=0)(3=0)(4=0)(5=1)(6=1)(7=.5)(8=.5)(else=.)

gen dparty = Q35
recode dparty (2=1)(else=0)

encode Group_1, gen (group11)
gen demgroups = group11

gen acceptstate = Q12
recode acceptstate (1=1)(2=.75)(3=.5)(4=.25)(5=0)

gen antidem = acceptstate if demgroups==1
gen prodem = acceptstate if demgroups==2

gen antidemyoung = antidem if age40==1
gen antidemold = antidem if age40==2

gen prodemyoung = prodem if age40==1
gen prodemold = prodem if age40==2

gen medianocensor = Q13_1
recode medianocensor (1=1)(2=.75)(3=.5)(4=.25)(5=0)

gen womenrights = Q13_2
recode womenrights (1=1)(2=.75)(3=.5)(4=.25)(5=0)

gen strongleader = Q13_3
recode strongleader (1=1)(2=.75)(3=.5)(4=.25)(5=0)

gen honestelections = Q13_4
recode honestelections (1=1)(2=.75)(3=.5)(4=.25)(5=0)

gen judicial = Q13_5
recode judicial (1=1)(2=.75)(3=.5)(4=.25)(5=0)

gen civicmovements = Q13_6
recode civicmovements (1=1)(2=.75)(3=.5)(4=.25)(5=0)

gen oppoparties = Q13_7
recode oppoparties (1=1)(2=.75)(3=.5)(4=.25)(5=0)

gen essent_elections = Q14_1/100
gen essent_military = Q14_2/100
gen essent_gender = Q14_3/100
gen essent_religion = Q14_4/100
gen essent_civil = Q14_5/100

gen currentdem = (Q15-1)/9

gen statedepend = Q16_1
recode statedepend (1=1)(2=.75)(3=.5)(4=.25)(5=0)

gen statestrong = Q16_2
recode statestrong (1=1)(2=.75)(3=.5)(4=.25)(5=0)

gen dembest = Q16_3
recode dembest (1=1)(2=.75)(3=.5)(4=.25)(5=0)


*** Analysis ***

mean Q15
mean Q15 if age40==1
mean Q15 if age40==2

mean essent_elections
mean essent_military
mean essent_gender
mean essent_religion
mean essent_civil

mean medianocensor
mean womenrights
mean strongleader
mean honestelections
mean judicial
mean civicmovements
mean oppoparties

ttest antidem = prodem, unpaired

ttest antidemyoung = antidemold, unpaired

reg acceptstate age11 income1 gender class1 edu employment married dparty if demgroups==1
estimates store A
reg acceptstate age11 income1 gender class1 edu employment married dparty if demgroups==2
estimates store B
estout A B, cells(b(star fmt(3)) se(par fmt(2)))
